package cn.yanhu.kuwanapp.home.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 *
 * 类描述：
 * 创建人：woochen
 * 创建时间：2020/9/21 6:01 PM
 * 修改备注：
 **/
class ViewPageAdapter : FragmentStateAdapter {
    private var fragments:List<Fragment>

    constructor(fragment: Fragment, fragments:List<Fragment>):super(fragment){
        this.fragments = fragments
    }

    constructor(fragmentActivity: FragmentActivity, fragments:List<Fragment>):super(fragmentActivity){
        this.fragments = fragments
    }

    override fun getItemCount(): Int = fragments.size

    override fun createFragment(position: Int): Fragment = fragments[position]

}